{% extends 'base.html' %}

{% block title %}搜索结果页面{% endblock %}

{% block left %}
    <div>
        <ul>
            {% if query %}
                {% for rtag in page.object_list %}
                    <li>
                        <a href="/post/{{rtag.object.id}}">{{rtag.object.title}}</a>&emsp;&emsp;{{rtag.object.created|date:'Y-m-d H:i'}}&emsp;&emsp;{{rtag.object.category.category}}：
                        {% for tag in rtag.object.tag.all %}
                            <span>{{tag.tag}}</span>&emsp;
                        {% endfor %}
                    </li>
                    <hr/>
                {% empty %}
                    <span>无记录</span>
                {% endfor %}
            {% endif %}
        </ul>
    </div>
    {% if page.has_previous or page.has_next %}
        <div>
            {% if page.has_previous %}
                <a href="?q={{query}}&page={{page.previous_page_number}}">上一页 << </a>
            {% endif %}
            {% if page.has_next %}
                <a href="?q={{query}}&page={{page.next_page_number}}"> >> 下一页</a>
            {% endif %}
        </div>
    {% endif %}
{% endblock %}
